// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App.vue'

import store from './store/index'

import VueRouter from 'vue-router'
import routes from './router/index'
import FastClick from 'fastclick'
import { getTheme } from "./utils/index";
Vue.prototype.getTheme = getTheme;
import './config/rem'
import {
  routerMode
} from './config/env'

import smoothscroll from 'smoothscroll-polyfill';

// kick off the polyfill!
smoothscroll.polyfill();

// import {
//   DatetimePicker
// } from 'vant';
// import {
//   Popup
// } from 'vant';
// import {
//   Picker
// } from 'vant';
// import {
//   SwipeCell,
//   Uploader
// } from 'vant';

// import 'vant/lib/index.css';
// import 'vant/lib/popup/style';
// import 'vant/lib/datetime-picker/style';

// Vue.use(DatetimePicker);
// Vue.use(Popup);
// Vue.use(Picker);
// Vue.use(SwipeCell);
// Vue.use(Uploader);


// import AMap from 'vue-amap';
// Vue.use(AMap)
// AMap.initAMapApiLoader({
//   key: 'bfb69995bbc948afc22a5544b67e30ff',
//   plugin: ['AMap.Geolocation','AMap.CitySearch']
// });

Vue.use(VueRouter)
const router = new VueRouter({
  routes,
  // mode: routerMode,
  mode: "hash",

  strict: process.env.NODE_ENV !== 'production',
  scrollBehavior(to, from, savedPosition) {
    // console.log('----savedPosition----', savedPosition)
    // if (savedPosition) {
    //   return savedPosition
    // } else {
    //   return { x: 0, y: 0 }
    // }
  }
})
router.beforeEach((to, from, next) => {
  // document.documentElement.scrollTop = 0;

  next()
});
// router.afterEach(()=>{
//   window.scr
// })
if ('addEventListener' in document) {
  document.addEventListener('DOMContentLoaded', function () {
    FastClick.attach(document.body);
  }, false);
}

// Vue.config.productionTip = false

/* eslint-disable no-new */
// new Vue({
//   el: '#app',

//   router,
//   components: { App },
//   template: '<App/>'
// })
// new Vue({
//   router,
//   store,
//     components: { App },
//     template: '<App/>'

// }).$mount('#app')

// new Vue({
//   el: '#app',
//   router,
//   store,
//   components: { App },
//   template: '<App/>'
// })

new Vue({
  router,
  store,
}).$mount('#app')
